#pragma once

#include <map>

#include "RenderNode.hpp"
#include "D3D11EffectPass.hpp"
#include "EffectTechnique.hpp"




namespace Engine
{
	namespace Video
	{
		class D3D11EffectTechnique
			: public EffectTechnique
		{
		public:

			typedef std::pair<const std::string, D3D11EffectPass>   Pass;
			typedef std::map<std::string, D3D11EffectPass>          Passes;

		public:

			D3D11EffectTechnique(const ID3D11DevicePtr& device);



			/**
			 * Add a pass to this technique.
			 */
			EffectPass& addPass(const std::string& name);

			/**
			 * Draw this pass using the given context and rendernode.
			 */
			void draw(const ID3D11DevicePtr& device, D3D11DeviceContext& context, const RenderNode::ptr& node);

			/**
			 * Optimizes memory usage freeing the reflection data of all passes.
			 */
			void optimize();

		private:

			ID3D11DevicePtr   m_device;
			Passes            m_passes;
		};
		///////////////////////////////////////////////////////////////////////////////////////////
	}
	///////////////////////////////////////////////////////////////////////////////////////////////
}
///////////////////////////////////////////////////////////////////////////////////////////////////
